﻿@model IEnumerable<FlowerShop.Core.Models.Tgood>
@{
    ViewBag.Title = "商品列表";
}


<h2>Index</h2>

<table class="table">
    <thead>
        <tr>
            <th>商品编号</th>
            <th>商品名称</th>
            <th>价格</th>
            <th>库存</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in Model)
        {
            <tr>
                <td>@item.G_id</td>
                <td>@item.G_name</td>
                <td>@item.G_xiaoshoujia</td>
                <td>@item.G_kuchun</td>
                <td>
                    @Html.ActionLink("查看详情", "Details", new { id = item.G_id }) |
                    @using (Html.BeginForm("AddToCart", "Cart", FormMethod.Post))
                    {
                        <input type="hidden" name="productId" value="@item.G_id" />
                        <input type="submit" value="加入购物车" />
                    }
                </td>
            </tr>
        }
    </tbody>
</table>
